package com.wn.web;

import com.wn.common.pojo.Destination;
import com.wn.common.pojo.ReqDestination;
import com.wn.common.pojo.Rsp;
import com.wn.service.DestinationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @BelongsProject: hurricane_travel
 * @BelongsPackage: com.wn.web
 * @Author: lhq
 * @Description: 目的地控制层
 */
@RestControllerAdvice
@RequestMapping("destination")
public class DestinationController {
    private static final Logger log = LoggerFactory.getLogger(DestinationController.class);
    @Autowired
    private DestinationService destinationService;

    /**
     * 级联查询
     */
    @PostMapping("getDestinationList")
    public Rsp getDestinationList(@RequestBody ReqDestination reqDestination){

        return destinationService.getDestinationList(reqDestination);
    }


    @PostMapping("getAllDestination")
    public Rsp getAllDestination(){

        Rsp allDestination = destinationService.getAllDestination();

        return allDestination;

    }

    /**
     * 级别为1
     * @return
     */
    @PostMapping("getDestinationParent")
    public Rsp getDestinationParent(){

        Rsp destination = destinationService.getDestinationParent();

        return destination;
    }

    /**
     * 级别为0
     * @return
     */
    @PostMapping("getDestinationSuperior")
    public Rsp getDestinationSuperior(){

        Rsp destinationSuperior = destinationService.getDestinationSuperior();

        return destinationSuperior;
    }

    /**
     * 根据级别0的搜索下一级
     * @return
     */
    @PostMapping("getDestinationListByParentId")
    public Rsp getDestinationListByParentId(@RequestBody Destination destination){
        Rsp rsp = destinationService.getDestinationListByParentId(destination);

        return rsp;
    }

}
